qx.Class.define("ui.view.PageNwNews", {
	extend : qx.ui.tabview.Page,
	construct : function() {
		this.base(arguments);
		this.setLabel("Agregar Noticia");
		var titulo = new qx.ui.form.TextField();
		var idTema = new qx.ui.form.TextField();
		var contenido = new qx.ui.form.TextField();
		this.setLayout(new qx.ui.layout.Basic());
		var container = this;
		// this.add(container);
		container.add(titulo, {
			left : 100,
			top : 50
		});
		container.add(idTema, {
			left : 100,
			top : 80
		});
		container.add(contenido, {
			left : 100,
			top : 110
		});
		var send = function() {
			var req = new qx.io.request.Xhr("/rpc/noticia/guardar");
			req.setRequestData({
				'titulo' : titulo.getValue(),
				'contenido' : contenido.getValue(),
				'idTema' : idTema.getValue(),
				'fecha' : 20121010
			});
			req.addListener("success", function(e) {
				var res = e.getTarget().getResponse();
				alert(res);
			}, this);
			req.send();
		};
		
		var button1 = new qx.ui.form.Button("Enviar");
		
		this.add(button1,{
			left : 200,
			top : 80
		})
		button1.addListener("execute", function(e) {
			  send();
			});
	},
	members : {
		__form : null,
		getForm : function() {
			return this.__form;
		},
		initForm : function() {
			this.__form = new qx.ui.form.Form();
			var username = new qx.ui.form.TextField();
			username.setRequired(true);
			this.__form.add(username, "Username", null, "username");
			var password = new qx.ui.form.PasswordField();
			password.setRequired(true);
			this.__form.add(password, "Password", null, "password");
			var cancelbutton = new qx.ui.form.Button("Cancel");
			this.__form.addButton(cancelbutton);
			cancelbutton.addListener("execute", function() {
				this.getForm().reset();
			}, this);

		}
	}
});